/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pokemon.dao;

import com.pokemon.entities.Trainer;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

/**
 *
 * @author Ladislav Olšák
 */
public interface TrainerDAO {
    
    /*
     * Create new trainer
     * 
     * @param trainer   Added trainer.
     * @throws IllegalArgumentException when trainer == null
     * @throws IllegalArgumentException when id is set
     */
    void addTrainer(Trainer trainer);
    
    /*
     * Find trainer by id
     *
     * @param id   Id of trainer.
     * @return trainer entity with given id
     * @throws IllegalArgumentException when id == null
     */
    Trainer getTrainer(Long id);
    
    /*
     * Update trainer in database
     * 
     * @param trainer   Updated trainer.
     * @throws IllegalArgumentException when trainer == null
     * @throws IllegalArgumentException when id is not set
     */
    void updateTrainer(Trainer person);
    
    /*
     * Remove trainer from database
     * 
     * @param trainer   Removed trainer.
     * @throws IllegalArgumentException when trainer == null
     * @throws IllegalArgumentException when id is not set
     */
    void removeTrainer(Trainer person);
    
    /*
     * Find all trainers
     *
     * @return list of all trainets
     */
    List<Trainer> getAllTrainers();
    
    /**
     * Method sets entity manager factory.
     * 
     * @param entityManagerFactory
     */
    void setEntityManagerFactory(EntityManagerFactory entityManagerFactory);
    
    public void setEm(EntityManager em);
}
